package huadi.algorithm.sort;

/**
 * BubbleSort 冒泡排序
 *
 * @author Huadi
 */
public class BubbleSort {
    public static void sort(int[] array) {
        for (int i = array.length; i > 0; i--) {
            for (int j = 0; j < i - 1; j++) {
                if (array[j] > array[j + 1]) {
                    int t = array[j];
                    array[j] = array[j + 1];
                    array[j + 1] = t;
                }
            }
        }
    }
}
